﻿using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    public partial class TSACHBE : ViewBase
    {
        #region ==SACHBE===========
        public static readonly DependencyProperty SACHBEProperty = DependencyProperty.Register("SACHBE",
            typeof(string), typeof(TSACHBE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSACHBEChanged));
        public string SACHBE
        {
            get
            {
                return (string)GetValue(SACHBEProperty);
            }
            set
            {
                SetValue(SACHBEProperty, value);
            }
        }
        private static void OnSACHBEChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as TSACHBE;
            if (src != null)
            {
                src.SACHBE = (string)e.NewValue;
            }
        }
        #endregion
        public TSACHBE()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VVKPOS();
            this.DataContext = MV;
            InitializeComponent(); 
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            if (dwMaster == null)
            {
                SACHBE = "";
                return;
            }
            SACHBE = dwMaster["SACHBE"].ToString();
        }
         
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            base.Window_Loaded(sender, e);
            SResult = ((VVKPOS)MV).QueryVKPOS(dwData, -3); 
            MergeData(SResult,false);
            vwMaster.View.MoveCurrentTo(-1);
        }
    }
}
